#include"Book.h"

void Book::Borrow()
{
  judge_borrow=true;
}

void Book::Return()
{
  judge_borrow=false;
}

void Book::Show()
{
  cout<<"ISBN:"<<ISBN<<endl;
  cout<<"Book name:"<<book_name<<endl;
  cout<<"Book author:"<<author<<endl;
  
  int n=type;
  if(n==0)
    cout<<"Book type:fiction"<<endl;
  else if(n==1)
    cout<<"Book type:nonfiction"<<endl;
  else if(n==2)
    cout<<"Book type:periodical"<<endl;
  else if(n==3)
    cout<<"Book type:biography"<<endl;
  else
    cout<<"Book type:children"<<endl;
  
  cout<<"Edition date:"<<edition_date<<endl;
  
  if(judge_borrow==true)
    cout<<"Book state:the book has been borrowed"<<endl;
  else
    cout<<"Book state:the book is available"<<endl;
}

bool Book::operator==(const Book& temp)
{
  if(ISBN==temp.ISBN)
    return true;
  else
    return false;
}

bool Book::operator!=(const Book& temp)
{
  return !(*this==temp);
}

ostream& operator<<(ostream& os,const Book& temp)
{
  os<<"Book name:"<<temp.book_name<<endl;
  os<<"Book author:"<<temp.author<<endl;
  os<<"ISBN:"<<temp.ISBN<<endl;
  return os;
}
